return NULL;
}
+static inline int netbk_max_required_rx_slots(netif_t *netif)
+{
+ if (netif->features & (NETIF_F_SG|NETIF_F_TSO))
+ return MAX_SKB_FRAGS + 2; /* header + extra_info + frags */
+ return 1; /* all in one */
+}
+
static inline int netbk_queue_full(netif_t *netif)
{
- RING_IDX peek = netif->rx_req_cons_peek;
+ RING_IDX peek = netif->rx_req_cons_peek;
+ RING_IDX needed = netbk_max_required_rx_slots(netif);
- return ((netif->rx.sring->req_prod - peek) <= (MAX_SKB_FRAGS + 1)) ||
- ((netif->rx.rsp_prod_pvt + NET_RX_RING_SIZE - peek) <=
- (MAX_SKB_FRAGS + 1));
+ return ((netif->rx.sring->req_prod - peek) < needed) ||
+ ((netif->rx.rsp_prod_pvt + NET_RX_RING_SIZE - peek) < needed);
}
int netif_be_start_xmit(struct sk_buff *skb, struct net_device *dev)
if (netbk_can_queue(dev) && netbk_queue_full(netif)) {
netif->rx.sring->req_event = netif->rx_req_cons_peek +
- MAX_SKB_FRAGS + 2;
+ netbk_max_required_rx_slots(netif);
mb(); /* request notification /then/ check & stop the queue */
if (netbk_queue_full(netif))
netif_stop_queue(dev);
goto abort_transaction;
}
-#if 0 /* KAF: After the protocol is finalised. */
err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv4",
"%d", 1);
if (err) {
message = "writing feature-gso-tcpv4";
goto abort_transaction;
}
-#endif
err = xenbus_transaction_end(xbt, 0);
} while (err == -EAGAIN);
be->netif->dev->features |= NETIF_F_SG;
}
-#if 0 /* KAF: After the protocol is finalised. */
if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-gso-tcpv4", "%d",
&val) < 0)
val = 0;
be->netif->features |= NETIF_F_TSO;
be->netif->dev->features |= NETIF_F_TSO;
}
-#endif
/* Map the shared frame, irq etc. */
err = netif_map(be->netif, tx_ring_ref, rx_ring_ref, evtchn);
goto abort_transaction;
}
-#if 0 /* KAF: After the protocol is finalised. */
err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv4", "%d", 1);
if (err) {
message = "writing feature-gso-tcpv4";
goto abort_transaction;
}
-#endif
err = xenbus_transaction_end(xbt, 0);
if (err) {
if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
"feature-gso-tcpv4", "%d", &val) < 0)
val = 0;
-#if 0 /* KAF: After the protocol is finalised. */
if (!val)
-#endif
return -ENOSYS;
}